<!--
 * @Author: yaojian66 1327629137@qq.com
 * @Date: 2022-06-27 15:41:57
 * @LastEditors: yaojian66 1327629137@qq.com
 * @LastEditTime: 2022-06-27 16:26:03
 * @FilePath: \geyao\第七十一题 阻止冒泡事件.html
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
-->
<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>阻止冒泡事件</title>
</head>

<body>
  <ul>
    <li>nowcoder</li>
</ul>
  <!-- 请补全JavaScript函数，要求在点击li元素的时候不触发ul的事件。
注意：需要自行获取li元素。 -->
<script>
  var li = document.querySelector("li");
li.addEventListener('click', function(e){
    e.stopPropagation();
})
</script>
</body>
</html>